home *** CD-ROM | disk | FTP | other *** search
-
-
-
- getnetent(3) getnetent(3)
-
-
- NNAAMMEE
- getnetent, getnetbyaddr, getnetbyname, setnetent, endne-
- tent - get networks entry
-
- SSYYNNTTAAXX
- ##iinncclluuddee <<nneettddbb..hh>>
-
- ssttrruucctt nneetteenntt **ggeettnneetteenntt(())
-
- ssttrruucctt nneetteenntt **ggeettnneettbbyynnaammee((_n_a_m_e))
- cchhaarr **_n_a_m_e;;
-
- ssttrruucctt nneetteenntt **ggeettnneettbbyyaaddddrr((_n_e_t,, _t_y_p_e))
- lloonngg _n_e_t;; iinntt _t_y_p_e;;
-
- vvooiidd sseettnneetteenntt((_s_t_a_y_o_p_e_n))
- iinntt _s_t_a_y_o_p_e_n;;
-
- vvooiidd eennddnneetteenntt(())
-
- DDEESSCCRRIIPPTTIIOONN
- The _g_e_t_n_e_t_e_n_t, _g_e_t_n_e_t_b_y_n_a_m_e, and _g_e_t_n_e_t_b_y_a_d_d_r subroutines
- each return a pointer to an object with the following
- structure containing the broken-out fields of a line in
- the _n_e_t_w_o_r_k_s database.
-
- struct netent {
- char *n_name; /* official name of net */
- char **n_aliases; /* alias list */
- int n_addrtype; /* net number type */
- long n_net; /* net number */
- };
-
- The members of this structure are:
-
- n_name The official name of the network.
-
- n_aliases A zero terminated list of alternate names for
- the network.
-
- n_addrtype The type of the network number returned:
- AF_INET.
-
- n_net The network number. Network numbers are
- returned in machine byte order.
-
- If the _s_t_a_y_o_p_e_n flag on a _s_e_t_n_e_t_e_n_t subroutine is NULL,
- the _n_e_t_w_o_r_k_s database is opened. Otherwise the _s_e_t_n_e_t_e_n_t
- has the effect of rewinding the _n_e_t_w_o_r_k_s database. The
- _e_n_d_n_e_t_e_n_t may be called to close the _n_e_t_w_o_r_k_s database
- when processing is complete.
-
- The _g_e_t_n_e_t_e_n_t subroutine simply reads the next line while
- _g_e_t_n_e_t_b_y_n_a_m_e and _g_e_t_n_e_t_b_y_a_d_d_r search until a matching _n_a_m_e
-
-
-
- 1
-
-
-
-
-
- getnetent(3) getnetent(3)
-
-
- or _n_e_t number is found (or until EOF is encountered). The
- _t_y_p_e must be AF_INET. The _g_e_t_n_e_t_e_n_t subroutine keeps a
- pointer in the database, allowing successive calls to be
- used to search the entire file.
-
- A call to _s_e_t_n_e_t_e_n_t must be made before a _w_h_i_l_e loop using
- _g_e_t_n_e_t_e_n_t in order to perform initialization and an _e_n_d_n_e_-
- _t_e_n_t must be used after the loop. Both _g_e_t_n_e_t_b_y_n_a_m_e and
- _g_e_t_n_e_t_b_y_a_d_d_r make calls to _s_e_t_n_e_t_e_n_t and _e_n_d_n_e_t_e_n_t _.
-
- FFIILLEESS
- _/_e_t_c_/_n_e_t_w_o_r_k_s
-
- DDIIAAGGNNOOSSTTIICCSS
- Null pointer (0) returned on EOF or error.
-
- SSEEEE AALLSSOO
- networks(5)
- RFC 1101
-
- HHIISSTTOORRYY
- The getnetent(), getnetbyaddr(), getnetbyname(), setne-
- tent(), and endnetent() functions appeared in 4.2BSD.
-
- BBUUGGSS
- The data space used by these functions is static; if
- future use requires the data, it should be copied before
- any subsequent calls to these functions overwrite it.
- Only Internet network numbers are currently understood.
- Expecting network numbers to fit in no more than 32 bits
- is probably naive.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 2
-
-
-